﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Harkon.AppServer.cOne.Service;
using Harkon.AppServer.cOne.Registry;
using System.Threading;
using System.Diagnostics;

namespace ComponentB
{
    public class SomeUser : AbstractService, ISomeInterface
    {
        public IConsumer Consumer { get; set; }

        long min = long.MaxValue;
        long max = long.MinValue;
        long sum = 0;
        int count = 0;

        #region ISomeInterface Members

        public string DoingDoing(string stuff)
        {
            Stopwatch watch = new Stopwatch();
            watch.Start();
            Consumer.PerformAction("Make things happen!");
            watch.Stop();

            long elapsed = watch.ElapsedTicks;
            if (min > elapsed)
                min = elapsed;
            if (max < elapsed)
                max = elapsed;

            sum += elapsed;
            count++;

            return "ready";
        }

        #endregion
    }
}
